//
//  CDModelView.m
//  XKGN
//
//  Created by zhongweiMacPro on 2021/8/2.
//

#import "CDModelView.h"
#include <JRMemory/MemScan.h>
@implementation CDModelView

+ (instancetype)currentScreenInfo {
    static CDModelView *screenInfo = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        screenInfo = [[self alloc] init];
    });
    return screenInfo;
}

#pragma mark 功能回调
- (void)playFuncName:(NSString *)funcName andState:(BOOL)isSucc {


    if ([funcName isEqualToString:@"京"]) {

        if (isSucc) {
            //开
            dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
            dispatch_async(queue, ^{

                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x00000000,0x160000000};
                uint32_t search = 5100;
                engine.JRScanMemory(range, &search, JR_Search_Type_UInt);
                vector<void*>results = engine.getAllResults();
                uint32_t modify = 999999;
                for(int i = 0; i < results.size(); i++){
                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_UInt);
                }

            });
                dispatch_async(queue, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x00000000,0x160000000};
                uint32_t search = 63750;
                engine.JRScanMemory(range, &search, JR_Search_Type_UInt);
                vector<void*>results = engine.getAllResults();
                uint32_t modify = 999999;
                for(int i = 0; i < results.size(); i++){
                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_UInt);
                }

            });dispatch_async(queue, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x00000000,0x160000000};
                uint32_t search = 2000;
                engine.JRScanMemory(range, &search, JR_Search_Type_UInt);
                vector<void*>results = engine.getAllResults();
                uint32_t modify = 999999;
                for(int i = 0; i < results.size(); i++){
                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_UInt);
                }

            });dispatch_async(queue, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x00000000,0x160000000};
                uint32_t search = 11475;
                engine.JRScanMemory(range, &search, JR_Search_Type_UInt);
                vector<void*>results = engine.getAllResults();
                uint32_t modify = 999999;
                for(int i = 0; i < results.size(); i++){
                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_UInt);
                }
            });
//
        } else {
            //关


        }


    } else if ([funcName isEqualToString:@"维吉妮娅"]) {

        if (isSucc) {
            //开
            dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
            dispatch_async(queue, ^{

                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x00000000,0x160000000};
                uint32_t search = 12750;
                engine.JRScanMemory(range, &search, JR_Search_Type_UInt);
                vector<void*>results = engine.getAllResults();
                uint32_t modify = 999999;
                for(int i = 0; i < results.size(); i++){
                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_UInt);
                }

            });dispatch_async(queue, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x00000000,0x160000000};
                uint32_t search = 10200;
                engine.JRScanMemory(range, &search, JR_Search_Type_UInt);
                vector<void*>results = engine.getAllResults();
                uint32_t modify = 999999;
                for(int i = 0; i < results.size(); i++){
                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_UInt);
                }
            });

        } else {
            //关


        }

    } else if ([funcName isEqualToString:@"露西娅"]) {

        if (isSucc) {
            //开
            dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_SERIAL);
            dispatch_async(queue, ^{

                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x00000000,0x160000000};
                uint32_t search = 667;
                engine.JRScanMemory(range, &search, JR_Search_Type_UInt);
                vector<void*>results = engine.getAllResults();
                uint32_t modify = 999999;
                for(int i = 0; i < results.size(); i++){
                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_UInt);
                }

            });dispatch_async(queue, ^{
                JRMemoryEngine engine = JRMemoryEngine(mach_task_self());
                AddrRange range = (AddrRange){0x00000000,0x160000000};
                uint32_t search = 4500;
                engine.JRScanMemory(range, &search, JR_Search_Type_UInt);
                vector<void*>results = engine.getAllResults();
                uint32_t modify = 999999;
                for(int i = 0; i < results.size(); i++){
                    engine.JRWriteMemory((unsigned long long)(results[i]),&modify,JR_Search_Type_UInt);
                }
            });

        } else {
            //关


        }

    }

}

@end
